-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8370691: Add new Float16Vector type and enable intrinsification of vector operations supported by auto-vectorizer #28002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…float16 vector operations
|
👋 Welcome back jbhateja! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
|
@jatin-bhateja The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
|
/label add hotspot-compiler-dev |
|
@jatin-bhateja |
…ith Float16OperationsBenchmark
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some quick comments.
We should be consistent in the naming, and rename Halfloat* to Float16*.
When you generate the fallback code for unary/binary etc can you push the carrier type and conversations into the uOp/bOp implementations so you don't have to explicitly operate on the carrier type and do the conversions as you do now e.g.,:
v0.uOp(m, (i, a) -> float16ToShortBits(Float16.valueOf(-(shortBitsToFloat16(($type$)a).floatValue()))));
The transition of intrinsic arguments from vsp.elementType() to vsp.carrierType(), vsp.operType() is a little unfortunate. Is this because HotSpot cannot directly refer to the Float16 class from the incubating module? Requiring two arguments means they can get out of sync. Previously the class provided all the information needed, now arguably the type does.
I concur, especially since there are multiple 16-bit floating-point formats in use including the IEEE 754 float16 as well as bfloat16. |
|
We already have a lot of things in the codebase now from previous issues that use |
I was only referring to the Java code, esp. the new public classes so they align with the |
Yes, exactly. Maybe even in a quick renaming PR before this issue. Would be quickly reviewed, and would allow us to see complete consistency going forward with this PR here. |
|
Hi @PaulSandoz , Thanks for your comments. Please find below my responses.
Currently, uOp and uOpTemplates are part of the scaffolding logic and are sacrosanct; they are shared by various abstracted vector classes, and their semantics are defined by the lambda expression. I agree that explicit conversion in lambdas looks verbose, but moving them to uOpTemplate may fracture the lambda expression such that part of its semantics, i.e,. conversions, will seep into uOpTemplate, while what will appear at the surface will be the expression operating over primitive float values; this may become very confusing.
Yes, the idea here was to clearly differentiate b/w elemType and carrierType and avoid passing Float16.class as an argument to intrinsic entry points. Unlike the VectorSupport class, Float16 is part of the incubating module and cannot be directly exposed to VM, i.e., we cannot create a vmSymbol for it during initialization. This would have made all the lane type checks within inline expand name-based rather than efficient symbol lookup.
Yes, from the compiler standpoint point all we care about is the carrier type, which determines the vector lane size. This is augmented with operation kind (PRIM / FP16) to differentiate a short vector lane from a float16 vector lane. Apart from this, we need to pass the VectorBox type to wrap the vector IR. |
There are nomenclature issues that I am facing. Currently, all the Float16 concrete classes use the Halffloat prefix i.e., Halffloat64Vector, Halffloat128Vector; converting these to Float16 looks a little confusing, i.e., Float1664Vector, Float16128Vector, etc Kindly suggest a better name to represent these classes. |
Add new HalffloatVector type and corresponding concrete vector classes in addition to existing primitive vector types, maintaining operation parity with the FloatVector type.
The idea here is to first be at par with Float16 auto-vectorization support before intrinsifying new operations (conversions, reduction, etc).
The following are the performance numbers for some of the selected HalfflotVector benchmarking kernels compared to equivalent Float16OperationsBenchmark kernels.
Initial RFP[1] was floated on the panama-dev mailing list.
Kindly review the draft PR and share your feedback.
Best Regards,
Jatin
[1] https://mail.openjdk.org/pipermail/panama-dev/2025-August/021100.html
Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28002/head:pull/28002$ git checkout pull/28002Update a local copy of the PR:
$ git checkout pull/28002$ git pull https://git.openjdk.org/jdk.git pull/28002/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 28002View PR using the GUI difftool:
$ git pr show -t 28002Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28002.diff
Using Webrev
Link to Webrev Comment